﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Sofire.DataComm.Remoting
{
    /// <summary>
    /// 表示一个远程操作的参数内容。
    /// </summary>
    public class RemotingArguments
    {
        private RemotingCertificate _Certificate;
        /// <summary>
        /// 获取一个值，表示客户端的凭证。
        /// </summary>
        public RemotingCertificate Certificate
        {
            get
            {
                return this._Certificate;
            }
        }

        private int _MethodIdent=-1;
        /// <summary>
        /// 获取远程方法的标识。
        /// </summary>
        public int MethodIdent
        {
            get
            {
                return this._MethodIdent;
            }
        }

        private long _Token;
        /// <summary>
        /// 获取远程调用的标识。
        /// </summary>
        public long Token
        {
            get
            {
                return this._Token;
            }
        }

        private object[] _Parameters;
        /// <summary>
        /// 获取远程方法的参数集合。
        /// </summary>
        public object[] Parameters
        {
            get
            {
                return this._Parameters;
            }
        }

        private RemotingArguments() { }

        private RemotingArguments(long token)
        {
            this._Token = token;
        }

        internal RemotingArguments(long token, RemotingCertificate cert, int serviceVersion)
            : this(token)
        {
            if(cert == null) throw new ArgumentNullException("cert");
            this._Certificate = cert;
            this._Parameters = new object[1] { serviceVersion };
        }

        internal RemotingArguments(long token, int methodIdent, object[] parameters)
        {
            this._Token = token;
            this._MethodIdent = methodIdent;
            this._Parameters = parameters;
        }
    }
}
